package cn.ehanghai.htz.start;

import cn.ehanghai.htz.client.TcpClient;
import cn.ehanghai.htz.thread.PositionSaveQueueThread;
import cn.ehanghai.htz.thread.TcpClientReadAisThread;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextRefreshedEvent;
import org.springframework.stereotype.Component;

/**
 * @Author: xumf
 * @Date: 2019/7/5 8:19
 */
@Component
public class AisStartListener implements ApplicationListener<ContextRefreshedEvent> {

    private static final Logger logger=LoggerFactory.getLogger(AisStartListener.class);
    /**
     * 业务处理
     * @param event
     */
    @Override
    public void onApplicationEvent(ContextRefreshedEvent event) {
        logger.warn("---------监听开启------------");
        new PositionSaveQueueThread().start();
        TcpClient.setReadFlag(true);
        new TcpClientReadAisThread().start();



    }
}
